package cn.cyb.server.mapper;

import cn.cyb.server.domain.entity.SysUser;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SysUserMapper {

    @Select("select * from sys_user where user_name=#{userName}")
    @Results(id = "SysUserResult", value = {
            @Result(property = "userId", column = "user_id"),
            @Result(property = "userName", column = "user_name"),
            @Result(property = "nickName", column = "user_nick"),
            @Result(property = "password", column = "password"),
            @Result(property = "salt", column = "salt"),
            @Result(property = "createTime", column = "create_time"),
            @Result(property = "updateTime", column = "update_time"),
    })
    SysUser selectUserByUserName(String userName);

    @Select("select count(*) from sys_user")
    int getCount();

    @Select("select * from sys_user")
    @ResultMap("SysUserResult")
    List<SysUser> selectUserList();
}
